<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="vtc" uri="/vtc-core-tags"%>
<%@ include file="/common/taglibs.jsp"%>


<html>
<head>
	<title>Programme Maintenance</title>
	
	<script type="text/javascript">
	
	
	
		function clickBtn(action,id){
			switch(action){
			case "search":
				  $("#mainForm_search").attr("value", "true");
				  break;
				  
			case "clear":
				  $("#mainForm_search").attr("value", "false");
				  break;
				  
			case "create":
				  window.location="programme-info.action";
				  return;
				  
			case "copy":
				  window.location="programme-info!copy.action?copyFromId="+id;
				  return;	
				  
			case "revise":
				  window.location="programme-info!copy.action?canEditCode=NO&copyFromId="+id;
				  return;				  
			}
			
			$("#mainForm").submit();
		}

		
		function isDigit()
		{
		   var key = window.event.keyCode;   
		    if(key < 48 || key > 57){   
		       window.event.keyCode = 0 ;
		    }
		}

	</script>

</head>
<body>

<div class="content">  
  <div class="pageTitle">Programme Maintenance</div>
  
  <div class="form1">
  <s:form id="mainForm" name="mainForm" action="programme.action" method="post">
  	<s:hidden name="search"></s:hidden>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="sep" ><img src="../images/spacer.gif" style="width:180px;" /></td>
        <td class="sep" ><img src="../images/spacer.gif" style="width:180px;" /></td>
        <td class="sep" ><img src="../images/spacer.gif" style="width:180px;" /></td>
        <td class="sep sep2" ><img src="../images/spacer.gif" /></td>
      </tr>
      <tr>
        <td><label class="fLabel" >Launch Year </label>
          <div class="fField">
            <s:textfield name="programme.launchYear" cssStyle="width:150px" cssClass="inputText" maxLength="4" onkeypress="isDigit()" />
          </div></td>
        <td><label class="fLabel" >Launch Version </label>
          <div class="fField">
            <s:textfield name="programme.launchVersion" cssStyle="width:150px" cssClass="inputText"/>
          </div></td>
        <td><label class="fLabel" >Programme Code</label>
          <div class="fField">
            <s:textfield id="programme.code" name="programme.code" cssStyle="width:150px" cssClass="inputText"/>
          </div></td>
        <td><label class="fLabel" >Programme Board</label>
          <div class="fField">
            <s:select cssClass="inputSelect" cssStyle="width:155px" name="programme.board" 
            		  list="paramService.programmeBoardList" listKey="code" listValue="desc"
            		  headerKey="" headerValue="-- Select --">
            </s:select>
          </div></td>
      </tr>
      <tr>
        <td><label class="fLabel" >Discipline / Faculty / OU</label>
          <div class="fField">
            <s:select cssClass="inputSelect" cssStyle="width:155px" name="programme.discipline" 
            		  list="paramService.disciplineList" listKey="code" listValue="desc"
            		  headerKey="" headerValue="-- Select --">
            </s:select>
          </div></td>
        <td><label class="fLabel" >Funding Mode</label>
          <div class="fField">
            <s:select cssClass="inputSelect" cssStyle="width:155px" name="programme.fundingMode" 
            		  list="paramService.fundingModeList" listKey="code" listValue="desc"
            		  headerKey="" headerValue="-- Select --">
            </s:select>
          </div></td>
        <td><label class="fLabel" >Delivery Mode/ Study Mode</label>
          <div class="fField">
            <s:select cssClass="inputSelect" cssStyle="width:155px" name="programme.studyMode" 
            		  list="paramService.studyModeList" listKey="code" listValue="desc"
            		  headerKey="" headerValue="-- Select --">
            </s:select>
          </div></td>
        <td><label class="fLabel" >Programme Type</label>
          <div class="fField">
            <s:select cssClass="inputSelect" cssStyle="width:155px" name="programme.programmeType" 
            		  list="paramService.programmeTypeList" listKey="code" listValue="desc"
            		  headerKey="" headerValue="-- Select --">
            </s:select>
          </div></td>
      </tr>
      <tr>
        <td colspan="2"><label class="fLabel" >Level of Study</label>
          <div class="fField">
            <s:select cssClass="inputSelect" cssStyle="width:335px" name="programme.studylevel" 
            		  list="paramService.levelOfStudyList" listKey="code" listValue="desc"
            		  headerKey="" headerValue="-- Select --">
            </s:select>
          </div></td>
        <td colspan="2"><label class="fLabel" >Pre-employment / In-Service</label>
          <div class="fField">
            <s:select cssClass="inputSelect" cssStyle="width:335px" name="programme.preEmploymentInService" 
            		  list="paramService.preEmploymentInServiceList" listKey="code" listValue="desc"
            		  headerKey="" headerValue="-- Select --">
            </s:select>
          </div></td>
      </tr>
      <tr>
        <td colspan="3"><label class="fLabel" >Programme Title (Long)</label>
          <div class="fField">
            <s:textfield name="programme.titleLong" cssStyle="width:510px" cssClass="inputText"/>
          </div></td>
        <td><label class="fLabel" >Programme Status </label>
          <div class="fField">
           <s:select cssClass="inputSelect" cssStyle="width:155px" name="programme.status" 
            		  list="@com.lightsaber.trade.cloth.entity.programme.ProgrammeStatus@list()" listKey="key" listValue="value"
            		  headerKey="" headerValue="-- Select --">
            </s:select>            
          </div></td>
        </tr>
        </table>
        
	    <div class="btnSet btnSetTypeB">
		      <div class="left" >
		        <div class="button" >
		          <div class="left" >
		            <div class="right" >
		              <input class="inputButton" type="button" id="searchBtn" name="search" value="Search" onclick="clickBtn('search');"/>
		            </div>
		          </div>
		        </div>
		        
		        <div class="button" >
		          <div class="left" >
		            <div class="right" >
		              <input class="inputButton" type="button" id="clearBtn" name="clear" value="Clear" onclick="clickBtn('clear');"/>
		            </div>
		          </div>
		        </div>
		        
		        <div class="button" >
		          <div class="left" >
		            <div class="right" >
		            <security:authorize access="hasRole('PROGRAMME_MAIN_INSERT')">
		              <input class="inputButton" type="button" id="createBtn" name="create" value="Create" onclick="clickBtn('create')"/>
		              </security:authorize>
		            </div>
		          </div>
		        </div>
		        
	      </div>
      	</div>
    
		<s:if test="%{page!=null&&page.result!=null&&page.result.size()!=0}">
		<div class="sListBorder">
		   <div class="sList">
		     <table width="100%" cellspacing="0" cellpadding="0" border="0" class="sTable">
		       <tbody>
		       <tr>
		         <td style="width: 70px;" class="sTh t">Launch Year </td>
		         <td class="sTh t">Launch Version </td>
		         <td class="sTh t">Programme Code</td>
		         <td class="sTh t">Programme Title</td>
		         <td class="sTh t">Programme Board</td>
		         <td class="sTh t">Discipline</td>
		         <td class="sTh t">Funding Mode </td>
		         <td class="sTh t">Study Mode</td>
		         <td class="sTh t">Programme Type</td>
		         <td class="sTh t">Level of Study</td>
		         <td style="width: 150px;" class="sTh t">Pre-employment / In-Service</td>
		         <td class="sTh t">Programme Status</td>
		         <td class="sTh t">&nbsp;</td>
		         <td class="sTh t">&nbsp;</td>
		       </tr>
		       
		       <s:iterator value="page.result" var="programme" status="st">
		       
		      	  <s:set var="trClass" value="'sRow1'"></s:set>
		    	  <s:if test="#st.index%2==0">
		       	 		<s:set var="trClass" value="'sRow2'"></s:set>
			       	 <s:else>
			       	    <s:set var="trClass" value="'sRow1'"></s:set>
			       	 </s:else>
				  </s:if>
				  
			      <tr class="<s:property value='#trClass'/>">
			         <td class="sCell"><s:property value="#programme.launchYear"/></td>
			         <td class="sCell"><s:property value="#programme.launchVersion"/></td>
			         <td class="sCell">
				         <a href="programme-info.action?programmeId=<s:property value='#programme.id'/>" id="updatePro">
				         	<s:property value="#programme.code"/>
				         </a>
			         </td>
			         <script>
			         //var updatePro = document.getElementById("updatePro");
			         </script>
			         <td class="sCell"><s:property value="#programme.titleLong"/></td>
			         <td class="sCell"><s:property value="#programme.board"/></td>
			         <td class="sCell"><s:property value="#programme.discipline"/></td>
			         <td class="sCell"><vtc:code2label code="#programme.fundingMode"/></td>
			         <td class="sCell"><s:property value="#programme.studyMode"/></td>
			         <td class="sCell"><s:property value="#programme.programmeType"/></td>
			         <td class="sCell"><s:property value="#programme.studylevel"/></td>
			         <td class="sCell"><s:property value="#programme.preEmploymentInService"/></td>
			         <td class="sCell"><s:property value="#programme.status"/></td>
					 <td class="sCell buttonCell">
					 	<div class="button sbtn">
                             <div class="left">
                               <div class="right">
                               <security:authorize access="hasRole('PROGRAMME_MAIN_INSERT')">
                                 <input type="button" onclick="clickBtn('copy','<s:property value='#programme.id'/>')" value="Copy" name="" id="" class="inputButton">
                               </security:authorize>
                               </div>
                             </div>
                         </div>
                      </td>	
                      
					 <td class="sCell buttonCell">
					 	<div class="button sbtn">
                             <div class="left">
                               <div class="right">
                               <security:authorize access="hasRole('PROGRAMME_MAIN_INSERT')">
                                 <input type="button" onclick="clickBtn('revise','<s:property value='#programme.id'/>')" value="Revise" name="" id="" class="inputButton">
                               </security:authorize>
                               </div>
                             </div>
                         </div>
                      </td>	
                                            		         
		      	 </tr>		       
		       </s:iterator>
		     </tbody>
		     </table>
		   </div>
		   
		   <vtc:paging page="%{page}"></vtc:paging>
		 </div>
		</s:if> 
	
	</s:form> 
	</div>

</div>

</body>
</html>